#!/usr/bin/perl -w
use strict;
my $cmds = <<"C ShellCMD";
#01_setup_panda/cmds.pl
#02_create_db_schema/cmds.pl
#05_cache_ensembl_mysql_tables/cmds.pl
#06_tables_with_ensembl_data/table_ens_id.pl
#06_tables_with_ensembl_data/table_gene_go_matches.pl
#06_tables_with_ensembl_data/table_interpro_data.pl
#06_tables_with_ensembl_data/table_prot_exons.pl
#06_tables_with_ensembl_data/table_taxon_gene_descriptions.pl
#06_tables_with_ensembl_data/table_taxon_gene_loci.pl
#06_tables_with_ensembl_data/table_taxon_interpro_matches.pl
#07_tables_with_manually_updated_data/table_assembly_gaps_from_uscs.pl
#10_tables_with_data_from_all_species_before_custom/table_chromosomes.pl
#20_custom/table_ens_id.pl
#20_custom/table_prot_disruptions.pl
#20_custom/table_prot_exons.pl
#21_tables_with_data_from_all_species/table_exon_sequences.pl
#21_tables_with_data_from_all_species/table_sequences.pl
#22_table_ens_id_update/cmds.pl
#23_table_prot_coding_exons/table_prot_coding_exons.pl
#23_table_prot_coding_exons/table_prot_position.pl
#24_table_longest_transcript/cmds.pl
#30_table_genome_genome_align/cmds.pl
#30_table_genome_genome_align/run_make.pl
#31_resolve_phyop_orthologs/cmds.pl
32_table_closest_ortholog_paralog/table_closest_ortholog.pl
32_table_closest_ortholog_paralog/table_closest_paralog.pl
33_table_ortholog_sets/cmds.pl
34_table_syntenic_distances/cmds.pl
35_table_predicted_type/cmds.pl
36_table_orthologous_exons/cmds.pl
37_table_kaks_align/cmds.pl
38_table_pseudo_genes/cmds.pl
#39_update_ortholog_sets_with_zero_to_many/cmds.pl
40_update_ortholog_sets/cmds.pl
#41_table_syntenic_exons/cmds.pl
#42_table_synteny_blocks/cmds.pl
#43_table_significant_go_terms/homo_go_to_species.pl --species canis
#43_table_significant_go_terms/cmds.pl
#45_table_taxon_local_paralogs/cmds.pl
#46_analyse_paralogs/paralogues_functional_analysis.pl
#46_analyse_paralogs/paralogues_functional_summary.pl
C ShellCMD

#system("./get_up_to_date_from_ds_tree.cmd");

my @cmds = split /\n/, $cmds;


for my $cmd(@cmds)
{
	next if $cmd =~ /^#/;
	my ($exec) = split / /, $cmd;
	die $exec unless -f $exec;
}

for my $cmd(@cmds)
{
	next if $cmd =~ /^#/;
	open FROMEXEC, '-|' or exec $cmd or die "Failed [ $cmd ]\n$!\n";
	print while ( <FROMEXEC>);
	close FROMEXEC;
	die "Failed [ $cmd ]\n$!\n" unless $? == 0;
}




